package com.nageoffer.jobtrain.judge.controller;

import com.nageoffer.jobtrain.common.web.result.Result;
import com.nageoffer.jobtrain.common.web.result.Results;
import com.nageoffer.jobtrain.judge.dto.resp.OjQuestionSubmitRespDTO;
import com.nageoffer.jobtrain.judge.service.OjQuestionJudgeService;
import com.nageoffer.jobtrain.judge.service.dto.OjQuestionSubmitJudgeDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 系统判题控制层
 * author：唐晨
 */
@RestController
@RequiredArgsConstructor
public class OjQuestionJudgeController {
    private final OjQuestionJudgeService ojQuestionJudgeService;

    /**
     * 远程调用系统判题逻辑
     */
    @PostMapping("/api/job-train/judge/oj-judge")
    public Result<OjQuestionSubmitRespDTO> ojQuestionJudge(@RequestBody OjQuestionSubmitJudgeDTO requestParam) {
        return Results.success(ojQuestionJudgeService.ojQuestionJudge(requestParam));
    }
}
